package com.foreknow.elm.dao;


import com.foreknow.elm.po.Business;
import com.foreknow.elm.po.Cart;
import com.foreknow.elm.po.OrderDetailet;
import com.foreknow.elm.po.Orders;

import java.beans.ExceptionListener;
import java.sql.SQLException;
import java.util.List;

public interface OrdersDao {

    /**
     * 1.根据商家id用户id地址id商品总额 向oders表添加一条数据
     * 1-1根据商家id用户id地址id商品总额 返回编号
     * 2.根据用户id商家id在购物车cart表拿出foodId和quantity添加到订单明细表中orderdetails---返回改变行数
     * 3.根据用户id商家id删除购物车表的数据---返回改变行数
     */
    public int insertOrders(String userId,Integer businessId,Integer daId,Double orderTotal) throws SQLException;
//    public int getOrdersId(String userId,Integer businessId,Integer daId,Double orderTotal) throws SQLException;
//    public List<Cart> selectCart(String userId, Integer businessId) throws SQLException;
//    public int insertOrderDetailet(List<Cart> list);
//    public int deleteCart(String userId,Integer businessId);

    /**
     * 根据订单编号查询订单信息，包括所属商家信息，和此订单的所有订单明细信息
     * @param orderId
     * @return
     */
    public Orders getOrdersById(Integer orderId) throws Exception;
//    public Business getBusinessById(Integer orderId) throws Exception;
//    public List<OrderDetailet> getOrderDetailetById(Integer orderId) throws Exception;

    /**
     * 根据用户编号查询此用户的所有订单信息
     * @param userId
     * @return
     * @throws Exception
     */
    public List<Orders> listOrdersByUserId(String userId) throws Exception;

}